const fp = require("lodash/fp");
const cars = require("./data.json");

const _underscore = fp.replace(/\W+/g, "_");

// 名称转换规则：将非字母符号转换成下划线，再转换成小写字母
const converName = fp.flowRight(fp.toLower, _underscore);

const santizeNames = fp.map(({ name, ...rest }) => ({
  ...rest,
  name: converName(name),
}));

console.log(santizeNames(cars));
